<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title><ui:insert name="title">Home</ui:insert></title>
        <link rel="stylesheet" type="text/css" href="css.css" />
        <f:facet name="first">
            <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
            <title><ui:insert name="title">Home</ui:insert></title>
        </f:facet>
    </h:head>
    <h:body>
        <div id="wrapper">
            <div id="header">
                <div id="logo">
                    <h1><a href="index.xhtml">Reisbureau</a></h1>
                </div>
                <div id="menu">
                    <h:form>
                    <ul>
                        <li><a href="index.xhtml">Home</a></li>
                        <li ><a href="registratie.xhtml">Registreren</a></li>
                        <c:if test="#{not empty controllerInloggen.sessieKlant.email}">
                            <li ><h:commandLink action="boekingsHistory.xhtml" value="History"></h:commandLink></li>
                        </c:if>
                        <c:if test="#{not empty controllerInloggen.sessieKlant.email}">
                            <c:if test="#{controllerInloggen.sessieKlant.email == 'admin'}">
                                <li ><h:commandLink action="nieuweBestemming.xhtml" value="Admin"></h:commandLink></li>
                            </c:if>
                        </c:if>
                        <c:if test="#{not empty controllerInloggen.sessieKlant.email}">
                            <li ><h:commandLink action="#{controllerInloggen.uitloggen()}" value="Uitloggen"></h:commandLink></li>
                        </c:if>
                    </ul>
                    <br class="clearfix" />
                    </h:form>
                </div>
            </div>
            <div id="page">
                <div id="content">
                    <ui:insert name="content">

                    </ui:insert>
                </div>
                <div id="sidebar">
                    <h1>Inloggen</h1> <br />
                    <h:form>

                        <p:panel rendered="#{empty controllerInloggen.sessieKlant.email}">
                            <table>
                                <tr>
                                    <td>Email addres</td>
                                </tr>
                                <tr>
                                    <td>
                                        <p:inputText id="email"  value="#{controllerInloggen.klant.email}" validatorMessage="Er is geen email ingegeven om mee in te loggen!">
                                            <f:validateLength minimum="2" /> 
                                            <f:validateRequired /> 
                                        </p:inputText>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Passwoord</td>
                                </tr>
                                <tr>
                                    <td>
                                        <p:password id="paswoord" value="#{controllerInloggen.klant.wachtwoord}" validatorMessage="Er is geen paswoord ingegeven om mee in te loggen!">
                                            <f:validateRequired /> 
                                        </p:password>
                                    </td>
                                </tr>
                                <tr>
                                    <td> <br /><h:commandButton value="Inloggen" action="#{controllerInloggen.authenticate()}" /></td>
                                </tr>
                            </table>


                        </p:panel>
                    </h:form>

                    <h:form>
                        <p:panel rendered="#{not empty controllerInloggen.sessieKlant.email}">
                            <p>Gebruik de onderliggende knop om u uit te loggen.</p>
                            <h:commandButton value="uitloggen" action="#{controllerInloggen.uitloggen()}" />
                        </p:panel>
                    </h:form>
                </div>
                <br class="clearfix" />
            </div>
        </div>
        <div id="footer">
            Copyright (c) 2012 Matti Van Mechelen, Dries Hoefkens, Andy Deckers All rights reserved. Design by <a href="http://www.freecsstemplates.org/">FCT</a>.
        </div>
    </h:body>
</html>

